﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FRL.DebtChased.Types;

namespace FRL.DebtChased.Repository.ViewModels
{

	/// <summary>
	/// Declaration of SearchResultsModel class
	/// </summary>
	public class SearchResultsModel
	{

		/////////////////////////////////////////////////////////////
		// Nested classes

		public class Element
		{

			/////////////////////////////////////////////////////////
			// Attributes

			internal int m_iAccountId = 0;
			public int AccountId
			{
				get { return m_iAccountId; }
			}
			public string AccountRef { get; set; }

			public int ClientId { get; set; }
			public string ClientName { get; set; }

			public string DebtorName { get; set; }

			public Money Amount { get; set; }

			public string StatusAsText { get; set; }

		}

		/////////////////////////////////////////////////////////////
		// Attributes

		private List<Element> m_elements = new List<Element>();
		public List<Element> Elements
		{
			get { return m_elements; }
		}

		public string DebtorCompName { get; set; }
		public string DebtorFRLRef { get; set; }
		public string DebtorFirstName { get; set; }
		public string DebtorSurname { get; set; }
		public string DebtorEmail { get; set; }
		public string DebtorPostcode { get; set; }
		public string DebtorTel { get; set; }
		public string DebtorPrevPay { get; set; }
		public string DebtorMin { get; set; }
		public string DebtorMax { get; set; }
		public string CliCompName { get; set; }
		public string CliContName { get; set; }
		public string CliRef { get; set; }
		public bool IncludeLPCDA { get; set; }
		public bool IncludeClosedAccounts { get; set; }

		/////////////////////////////////////////////////////////////
		// Operations

		public void Load(DebtChasedEntities ent )
		{

			// TODO
			// Once design is agreed, implement read data in this function

			// Fake data
			m_elements.Add(new Element() { m_iAccountId = 1, AccountRef = "FRL918273", DebtorName = "Henry James", Amount = new Money(6532.56m, Money.eCurrency.Sterling), ClientName = "Vodafone Plc", StatusAsText = "Open" });
			m_elements.Add(new Element() { m_iAccountId = 2, AccountRef = "FRL102936", DebtorName = "Sarah Connor", Amount = new Money(3450m, Money.eCurrency.Sterling), ClientName = "Marks and Spencer", StatusAsText = "Open" });
			m_elements.Add(new Element() { m_iAccountId = 3, AccountRef = "FRL100276", DebtorName = "Tiling Is Us Ltd", Amount = new Money(2500m, Money.eCurrency.USDollar), ClientName = "Laundry Inc", StatusAsText = "Close" });
			m_elements.Add(new Element() { m_iAccountId = 4, AccountRef = "FRL100627", DebtorName = "Roof Repairs Inc", Amount = new Money(67000m, Money.eCurrency.Sterling), ClientName = "Knuth Services", StatusAsText = "Close" });

		}

	}

}
